package pa2.node;

import java.rmi.Remote;
import java.rmi.RemoteException;
import java.util.Map;

import pa2.util.Callback;
import pa2.util.EqualityCompare;




public interface Node <K extends EqualityCompare<K>, V, M extends Map<K,V>> extends Remote {

    /**
     * Returns the service name.
     *
     * @return the service name.
     */
    public final String SERVICENAME = "dht.Node";
    
    public void put(K key, V value, Callback<K,V> callback) throws RemoteException;
    public void get(K key, Callback<K,V> callback) throws RemoteException;
    public void remove(K key, Callback<K,V> callback) throws RemoteException;
    
    public K getKey() throws RemoteException;
    public NodeData<K,V,M> getData() throws RemoteException;
    
    public void addChild(Node<K, V, M> child) throws RemoteException;
    public void removeChild(Node<K,V,M> child) throws RemoteException;
    
    public Node<K, V, M> getLeftChild() throws RemoteException;
    public Node<K, V, M> getRightChild() throws RemoteException;
}
